
<div class="moduleTopNav">
	<?php $module->printAddLink($lang->get('add-groups')); ?>
</div>

<table class="datatable">
	<thead>
		<tr>
			<td width="50">&nbsp;</td>
			<td width="200"><?php $module->printSortLink($lang->get('title'), 'name'); ?></td>
			<td><?php $lang->put('num-users'); ?></td>
		</tr>
	</thead>
	<tbody>
		<?php
		
		$structure = array('name', 'numUsers');
		$module->setStructure($structure);
		
		$res = $module->queryData("SELECT * FROM ".$db->table('users_groups'), false);
		
		if(mysql_num_rows($res)) {
			while($row = mysql_fetch_array($res)) {
				
				$numUsers = $module->groups_getNumUsers($row['id']);
				
				if(!$numUsers) $numUsersT = $lang->get('no-users');
				else if($numUsers == 1) $numUsersT = $lang->get('one-users');
				else $numUsersT = $numUser.' '.$lang->get('many-users');
				
				$data = array(	'id'				=> stripslashes($row['id'])
								,'name'				=> stripslashes($row['name'])
								,'numUsers'			=> $numUsersT
								);
				$module->printTableRow($data);
				
			}
		} else {
			$module->printEmptyTableRow($lang->get('no-items-found'));
		}
		
		?>
	</tbody>
</table>
